package simulation;

import util.Vector;

/**
 * Create gravity force by extending force class
 * @author Gavin Ovsak
 */
public class GravityForce extends Force {
    
    private Vector myGravity;
    
    /**
     * Constructor for gravity force
     * @param gravityMagnitude 
     * @param gravityExponent 
     * @param index 
     */
    public GravityForce(int index, double gravityMagnitude, double gravityExponent) {
        super(index);
        myGravity = new Vector(gravityMagnitude, gravityExponent);
    }
    
    /**
     * Apply force to a Mass.
     * @param m 
     */
    @Override
    public void applyForce(Mass m) {
        if (isActive()) {
            m.applyForce(myGravity);
        }
    }
}

